On 10/28/2015 1:25 AM, TK
tk@... [DynoMotion] wrote:
Hi Sam,
I think this would be a very difficult thing to add
because of all the (unfortunate) dependencies on
operating on a file. Such as subroutine calls and
returns, error line number reporting, rewinding on
Halt, status callbacks, executing up to a certain line
number or number of lines, etc.
Why not write the the lines of GCode to a file? I
don't think the disk thrashing of the file is a
significant issue when you consider everything else
that occurs when invoking the Interpreter.
I do currently write the lines of gcode to a file. For
example, a macro button you press (G01 F50 X.01). Pressing
this several times in a row is very "stuttery" for lack of a
better word. The "generate temp file, write temp file,
Interpret(tempfile), delete temp file" cycle works fine at
times, then stutters other times. Sometimes this may be
because the Filesystem is doing something else for a moment,
latency in the hard drive device, etc. It has always seemed
a bit kludgy. This could perhaps be corrected with some type
of caching mechanism to minimize the write/read/delete
cycles but I haven't attempted that at this time.
I can understand where the rewinding on halt and status
callbacks would be an issue. Not to compromise the
usefulness of the original function too much, but perhaps
instead of a true overloaded method (implying it has the
same functionality), it could be a new method something
along the lines of:
Interpreter.InterpretLines(Lines as collection) as
ErrorBlock
where ErrorBlock is a structure/class of
.ErrorLineNumber
.ErrorMessage
.etc...
Obviously some functionality is lost, such as the
aforementioned status callbacks and such.
I see an added benefit to being able to have the app provide
the gcode to the interpreter in this manner: It opens up the
possibility of adding custom inline macros to the gcode that
are acted upon by the application. For example:
Currently a GCode file is saved and then loaded by Interpret
and run.
With an InterpretLines() method, the GCode file can be
"enhanced" by adding custom statements/functions that are
only interpreted by the application and ignored by GCode.
The application is given the opportunity to read the file
itself, act upon any custom statements, filter them out and
then pass the remaining true gcode lines to the
Interpret(Lines) method. A simple example:
G90
G01 F5 X1
(MyApp DoCustomFunction1)
G01 F5 X-1
(MyApp DoCustomFunction2)
Of course, this relies on my reading of the file and sending
line 1 and 2 to InterpretLine(), then acting internally upon
the line beginning with MyApp, the sending the next gcode
line to Interpret(), etc...but it does allow a certain
amount of customization of the GCode file, not that all
would want that as it means being careful with
compatibility.
I leave it in your hands to determine if it has merit for a
future version....thanks!
--
sam marrocco | chief technical officer
ringside.cutters.flavor.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com